package com.jr.util;

import java.util.ArrayList;

@SuppressWarnings("all")
//分页工具类
public class PageHelper {

    private Integer dataCount;  //查询数据的总条数
    private final Integer showNumber = 5; //每页显示的条数
    private Integer pageCount;  //参与分页的总页数
    private Integer pageIndex = 1;  //当前是第几页
    private ArrayList listIndex;    //当前页显示项的集合

    public Integer getDataCount() {
        return dataCount;
    }

    //传入数据总条数的同时计算好页面页数
    public void setDataCount(Integer dateCount) {
        this.dataCount = dateCount;
        pageCount = getPageCount();
    }

    public Integer getShowNumber() {
        return showNumber;
    }

   /*public void setShowNumber(Integer showNumber) {
        this.showNumber = showNumber;
    }*/

    public Integer getPageCount() {
        pageCount = this.dataCount % this.showNumber == 0 ?
                this.dataCount / this.showNumber :
                this.dataCount / this.showNumber + 1;
        return pageCount;
    }

    /*public void setPageCount(Integer pageCount) {
        this.pageCount = pageCount;
    }*/

    public Integer getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;
    }

    public ArrayList getListIndex() {
        return listIndex;
    }

    public void setListIndex(ArrayList listIndex) {
        this.listIndex = listIndex;
    }
}
